<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace longbingcore\tools;

class LongbingTime
{
    public static function getChinaNowTime()
    {
        return date("Y-m-d H:i:s", time());
    }
    public static function frendlyTime($data, $field = "create_time")
    {
        $time = time();
        $Yesterday = $time - 86400;
        $today = mktime(0, 0, 0, date("m", $time), date("d", $time), date("Y", $time));
        $Yesterday = mktime(0, 0, 0, date("m", $Yesterday), date("d", $Yesterday), date("Y", $Yesterday));
        foreach ($data as $index => $item) {
            $tmpTime = $item[$field];
            if($today < $tmpTime) {
                $data[$index]["radar_group"] = "今天";
                $data[$index]["radar_time"] = date("H:i", $item[$field]);
            } elseif($Yesterday < $tmpTime) {
                $data[$index]["radar_group"] = "昨天";
                $data[$index]["radar_time"] = date("H:i", $item[$field]);
            } else {
                $thisYear = date("Y");
                $itemYear = date("Y", $item[$field]);
                if($thisYear == $itemYear) {
                    $data[$index]["radar_group"] = date("m-d", $item[$field]);
                    $data[$index]["radar_time"] = date(" H:i", $item[$field]);
                } else {
                    $data[$index]["radar_group"] = date("Y-m-d", $item[$field]);
                    $data[$index]["radar_time"] = date(" H:i", $item[$field]);
                }
            }
        }
        return $data;
    }
}

?>